package com.ybb.vue.common.util;

/**
 * @author ybb
 * @version 1.0
 * @Description 数据脱敏处理工具类
 * @Date 2023/3/11 14:54
 */
public class AntianaphylaxisUtils {
    /**
     * 传入起始终止位置和脱敏字符
     */

    public static String antianaphylaxisUtil(int start, int end, String str) {
        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append(str);
        stringBuffer.replace(start, end, getReplaceString(end - start));
        return new String(stringBuffer);
    }

    private static String getReplaceString(int len){
        StringBuffer str = new StringBuffer();
        for (int i = 0; i < len; i++) {
            str.append("*");
        }
        return new String(str);
    }
}
